import 'package:pigeon/pigeon.dart';

/// @Author lixiaobin
/// @Date 2023/11/7
/// @Description
@ConfigurePigeon(PigeonOptions(
  input: 'pigeons/plugins_messages.dart',
  objcHeaderOut: '../ios_leaderdoctor/spr_ly/GeneralUtil/flutterTools/PluginsMessages.h',
  objcSourceOut: '../ios_leaderdoctor/spr_ly/GeneralUtil/flutterTools/PluginsMessages.m',
  objcOptions: ObjcOptions(),
  kotlinOut: '../leader_doctor/app/src/main/java/com/yzn/doctor_hepler/flutter/PluginMessages.kt',
  kotlinOptions: KotlinOptions(),
  dartOut: 'lib/plugins/plugins_messages.g.dart',
))
@HostApi()
abstract class NativeInterface {
  ///获取用户信息
  UserInfo getUserInfo();

  ///获取客服信息
  ServiceInfo getServiceInfo();

  ///获取包相关数据
  PackageInfo getPackageInfo();

  ///设备相关信息
  DeviceInfo getDeviceInfo();

  /// App 其它信息
  AppOtherInfo getAppOtherInfo();

  ///拨打电话
  void call(String phoneNumber);

  ///分享二维码下载
  void shareDownloadQr();

  ///检查更新
  void checkAppUpdate();

  ///关闭flutter页面容器
  void finishFlutterContainer();

  ///提示
  void toast(String msg);

  ///打开h5url页面
  void openH5Page(String? title, String url);

  ///会议状态变化
  void notifyMeetingStatusChanged(int meetingStatus, int meetingCode);

  /// 确认清除缓存
  void confirmClearCache();

  /// 确认退出登录
  void confirmLogOut();

  /// 选择文件 fileCount 文件选择数量，fileType 文件类型（image/file）图片和普通文件
  void selectFile(int fileCount, String fileType);

  /// 打开原生页面 pageName页面名称，parameter 传递的参数（可选）
  /// pageName:
  /// auth_page 认证页面
  /// auth_status 认证状态页面
  /// msg_history 历史记录
  /// image_text_consultation 打开会话页面
  /// video_call 视频呼叫
  /// pageName:
  /// auth_page(注册认证)，auth_status（认证提交中间页），
  /// set_avatar(设置头像),doctor_info(个人介绍)，my_signature（我的签名），auth_info（认证信息）
  void openNativePage(String pageName, String parameter);

  /// 设置email
  void setEmail(String email);

  /// 环境名称枚举 DEV DEV47 TEST RELEASE
  String getEnv();

  /// log 调用原生log数据
  void log(String log);

  /// 联系客服
  void contactCustomerService();

  /// 疾病分类
  void icdSelect(String icdCodeJson);
}

///原生调用 flutter
@FlutterApi()
abstract class FlutterInterface {
  /// 会议登出
  void meetingLogout();

  /// 会议最大化展示
  void cancelMeetingMinimizationWindow();

  /// 获取当前用户是否已经在会议中
  /// 0 可入会  -1已经在其他会议中 1再次进入相同的会议
  int findMeetingStatus(String mdtId);

  /// 文件选择后回调
  void onFileSelect(List<FileInfo> info);

  /// onResume
  void onResume(String tag);

  /// 头像设置完成回调
  void setAvatar();
}

class PackageInfo {
  ///包名
  String? appPackageName;

  ///app 版本号
  String? appVersionCode;

  ///app 版本名称
  String? appVersionName;
}

class ServiceInfo {
  ///客服邮箱
  String? email;

  ///客服电话
  String? phone;

  ///客服工作时间
  String? workingTime;

  ///公司地址
  String? address;
}

class UserInfo {
  String? id;
  String? sex;
  String? headIcon;
  String? phone;
  String? email;
  String? loginName;
  String? userName;
  String? realName;
  String? token;
  String? status;
  String? deleteFlag;
  String? tenantId;
  String? onLineMode;
  String? userJson;
}

class DeviceInfo {
  ///手机系统版本
  String? systemVersion;

  ///手机机型
  String? deviceModel;

  ///手机设备名称
  String? nickname;

  ///获取手机厂商
  String? brand;
}

class AppOtherInfo {
  /// App缓存
  String? cacheLength;
}

class FileInfo {
  /// 文件名称
  String? fileName;

  /// 文件类型
  String? fileType;

  /// 文件路径
  String? filePath;

  /// 文件byte数据
  Uint8List? bytes;
}
